#pragma once
#include "util.h"
#include "GameObject.h"

enum BlockType
{
	BLOCK_REG,
	BLOCK_GOAL,
	BLOCK_PLAYER,
	BLOCK_CHASER,
};

class Block : public GameObject
{
	public:
		Block(void);
		~Block(void);
		Block(float x, float y, float z, float len_x, float len_y, float len_z);
		Block(D3DXVECTOR3 pos, D3DXVECTOR3 dim);
		virtual int render(int time);

		int regenerateBlock();
		int createGraphicsBuffers(void);
		int createVtxDescription(void);

		void setCenterPosition(D3DXVECTOR3 centrePos);
		int setScale(float scaleX, float scaleY, float scaleZ);
		void setType(BlockType t);
		void setMaterial(float r, float g, float b);

		bool collidespoint(const D3DXVECTOR3 pos);
		bool collides(const D3DXVECTOR3 pos, float r);
		const D3DXVECTOR3 BottomCenterPos();

		struct DefaultVertex	*vertices;	// holds the vertices geometry
		long					*indices;	// holds the topolcoy (indices) of the geometry
		int						nVertices;
		int						nQuads;
		int						nTriangles;
		D3DXVECTOR3				dimensions;
		D3DXCOLOR				color;
		BlockType				type;
		bool					bWireframe;

		D3DMATERIAL9			material;
		LPDIRECT3DTEXTURE9		texture;

		static IDirect3DVertexDeclaration9* blockDecl;
};
